<script setup>
import { ref } from 'vue'

import { useAirStore } from '@/stores'
import { storeToRefs } from 'pinia'
const airStore = useAirStore()
const { operationData } = storeToRefs(airStore)
const videoNum = operationData.videosTotalNumber || 0
const videoNumArr = ref(videoNum.toString().split(''))

const imgNum = operationData.photosTotalNumber || 0
const imgNumArr = ref(imgNum.toString().split(''))
</script>

<template>
  <div class="achievement-count">
    <div class="video">
      <div class="title">视频总数</div>
      <div class="num">
        <p v-for="(item, index) in videoNumArr" :key="index">
          <NumberAnimate :count="56" />
        </p>
        <i>个</i>
      </div>
    </div>
    <div class="video">
      <div class="title">照片总数</div>
      <div class="pct-num">
        <p v-for="(item, index) in imgNumArr" :key="index">
          <NumberAnimate :count="2384" />
        </p>
        <i>个</i>
      </div>
    </div>
  </div>
</template>
<style scoped lang="scss">
.achievement-count {
  display: flex;
  padding: 10px;
  .video {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-content: center;
    width: 165px;
    height: 90px;
    background: url('@img/operation/video-bg.png');
    background-size: 100% 100%;

    &:nth-child(2) {
      margin-left: 8px;
    }

    .title {
      text-align: center;
    }

    .num {
      display: flex;
      justify-content: center;
      align-items: center;
      margin-top: 5px;
      p {
        width: 25px;
        height: 30px;
        background: url('@img/operation/num-bg.png');
        background-size: 100% 100%;
        font-family: DINAlternate;
        font-weight: bold;
        font-size: 24px;
        color: #33fff7;
        text-align: center;
        &:nth-child(2) {
          margin-left: 5px;
        }
      }
      i {
        font-weight: normal;
        font-style: normal;
        color: #2f9cff;
        margin-left: 5px;
        font-size: 16px;
      }
    }
  }
  .pct {
    background: url('@img/operation/pct-bg.png');
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-content: center;
    width: 165px;
    height: 90px;
    background-size: 100% 100%;
    span {
      display: inline-block;
      width: 19px;
      height: 28px;
    }
    div {
      display: flex;
      justify-content: center;
      align-items: center;
    }
  }
}
.pct-num {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 5px;

  p {
    width: 25px;
    height: 30px;
    background: url('@img/operation/num-pct-bg.png');
    background-size: 100% 100%;
    font-family: DINAlternate;
    font-weight: bold;
    font-size: 24px;
    color: #33fff7;
    text-align: center;
    &:nth-child(2) {
      margin-left: 5px;
    }
  }
  i {
    font-weight: normal;
    font-style: normal;
    color: #2f9cff;
    margin-left: 25px;
    font-size: 16px;
  }
}
</style>
